home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / powerins.c < prev    next >
C/C++ Source or Header  |  2000-05-10  |  13KB  |  401 lines

  1. /***************************************************************************
  2.  
  3.                           -= Power Instinct =-
  4.                             (C) 1993 Atlus
  5.  
  6.                 driver by    Luca Elia (eliavit@unina.it)
  7.  
  8. CPU:    MC68000
  9. Sound:    OKIM6295
  10.  
  11. - Note:    To enter test mode press F2 (Test)
  12.         Use 9 (Service Coin) to change page.
  13.  
  14. To Do: sprites flip y (not used by the game)
  15.  
  16.  
  17. ***************************************************************************/
  18. #include "driver.h"
  19. #include "vidhrdw/generic.h"
  20.  
  21. /* Variables that vidhrdw has access to */
  22.  
  23. /* Variables defined in vidhrdw */
  24. extern unsigned char *powerins_vram_0, *powerins_vctrl_0;
  25. extern unsigned char *powerins_vram_1, *powerins_vctrl_1;
  26. extern unsigned char *powerins_vregs;
  27.  
  28. /* Functions defined in vidhrdw */
  29. READ_HANDLER ( powerins_vregs_r );
  30. WRITE_HANDLER( powerins_vregs_w );
  31.  
  32. WRITE_HANDLER( powerins_paletteram_w );
  33.  
  34. WRITE_HANDLER( powerins_vram_0_w );
  35. WRITE_HANDLER( powerins_vram_1_w );
  36.  
  37. int  powerins_vh_start(void);
  38. void powerins_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  39.  
  40.  
  41. /***************************************************************************
  42.  
  43.  
  44.                                 Memory Maps
  45.  
  46.  
  47. ***************************************************************************/
  48.  
  49.  
  50. /***************************************************************************
  51.                                 Power Instinct
  52. ***************************************************************************/
  53.  
  54. READ_HANDLER( powerins_input_r )
  55. {
  56.     switch (offset)
  57.     {
  58.         case 0x00:    return readinputport(1);        // Coins + Start Buttons
  59.         case 0x02:    return readinputport(0);        // P1+P2
  60.         case 0x08:    return readinputport(2);        // DSW 1
  61.         case 0x0a:    return readinputport(3);        // DSW 2
  62.         case 0x3e:    return OKIM6295_status_0_r(0);    // OKI Status
  63.  
  64.         default:
  65.             logerror("PC %06X - Read input %02X !\n", cpu_get_pc(), offset);
  66.             return 0;
  67.     }
  68. }
  69.  
  70. static struct MemoryReadAddress powerins_readmem[] =
  71. {
  72.     { 0x000000, 0x0fffff, MRA_ROM                },    // ROM
  73.     { 0x100000, 0x10003f, powerins_input_r        },    // Input Ports
  74.     { 0x120000, 0x120fff, MRA_BANK2                },    // Palette
  75. /**/{ 0x130000, 0x130007, MRA_BANK3                },    // VRAM 0 Control
  76.     { 0x140000, 0x143fff, MRA_BANK4                },    // VRAM 0
  77.     { 0x170000, 0x170fff, MRA_BANK5                },    // VRAM 1
  78.     { 0x180000, 0x18ffff, MRA_BANK6                },    // RAM + Sprites
  79. //    { 0x990000, 0x99003f, powerins_vregs_r        },    // Fake: use to see the video regs.
  80.     { -1 }
  81. };
  82.  
  83. static struct MemoryWriteAddress powerins_writemem[] =
  84. {
  85.     { 0x000000, 0x0fffff, MWA_ROM                                    },    // ROM
  86.     { 0x100000, 0x10003f, powerins_vregs_w, &powerins_vregs            },    // Video Regs
  87.     { 0x120000, 0x120fff, powerins_paletteram_w, &paletteram        },    // Palette
  88.     { 0x130000, 0x130007, MWA_BANK3, &powerins_vctrl_0                },    // VRAM 0 Control
  89.     { 0x140000, 0x143fff, powerins_vram_0_w, &powerins_vram_0        },    // VRAM 0
  90.     { 0x170000, 0x170fff, powerins_vram_1_w, &powerins_vram_1        },    // VRAM 1
  91.     { 0x171000, 0x171fff, powerins_vram_1_w                            },    // Mirror of VRAM 1?
  92.     { 0x180000, 0x18ffff, MWA_BANK6, &spriteram                        },    // RAM + Sprites
  93.     { -1 }
  94. };
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102. /***************************************************************************
  103.  
  104.  
  105.                                 Input Ports
  106.  
  107.  
  108. ***************************************************************************/
  109.  
  110. INPUT_PORTS_START( powerins )
  111.     PORT_START    // IN0 - $100002 - Player 1 & 2
  112.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
  113.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT     | IPF_PLAYER1 )
  114.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 )
  115.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 )
  116.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER1 )
  117.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER1 )
  118.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3        | IPF_PLAYER1 )
  119.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4        | IPF_PLAYER1 )
  120.  
  121.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
  122.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT     | IPF_PLAYER2 )
  123.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 )
  124.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 )
  125.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER2 )
  126.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER2 )
  127.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3        | IPF_PLAYER2 )
  128.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4        | IPF_PLAYER2 )
  129.  
  130.     PORT_START    // IN1 - $100000 - Coins
  131.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
  132.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
  133.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
  134.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1   )
  135.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2   )
  136.     PORT_BITX(0x0020, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  137.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
  138.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
  139.  
  140.     PORT_START    // IN2 - $100008 - DSW 1
  141.     PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Free_Play ) )
  142.     PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
  143.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  144.     PORT_DIPNAME( 0x000e, 0x000e, DEF_STR( Coin_A ) )
  145.     PORT_DIPSETTING(      0x0008, DEF_STR( 4C_1C ) )
  146.     PORT_DIPSETTING(      0x0004, DEF_STR( 3C_1C ) )
  147. //    PORT_DIPSETTING(      0x000c, DEF_STR( 2C_1C ) )
  148.     PORT_DIPSETTING(      0x0000, DEF_STR( 2C_1C ) )
  149.     PORT_DIPSETTING(      0x000e, DEF_STR( 1C_1C ) )
  150.     PORT_DIPSETTING(      0x0006, DEF_STR( 1C_2C ) )
  151.     PORT_DIPSETTING(      0x000a, DEF_STR( 1C_3C ) )
  152.     PORT_DIPSETTING(      0x0002, DEF_STR( 1C_4C ) )
  153.     PORT_DIPNAME( 0x0070, 0x0070, DEF_STR( Coin_B ) )
  154.     PORT_DIPSETTING(      0x0040, DEF_STR( 4C_1C ) )
  155.     PORT_DIPSETTING(      0x0020, DEF_STR( 3C_1C ) )
  156. //    PORT_DIPSETTING(      0x0060, DEF_STR( 2C_1C ) )
  157.     PORT_DIPSETTING(      0x0000, DEF_STR( 2C_1C ) )
  158.     PORT_DIPSETTING(      0x0070, DEF_STR( 1C_1C ) )
  159.     PORT_DIPSETTING(      0x0030, DEF_STR( 1C_2C ) )
  160.     PORT_DIPSETTING(      0x0050, DEF_STR( 1C_3C ) )
  161.     PORT_DIPSETTING(      0x0010, DEF_STR( 1C_4C ) )
  162.     PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) )
  163.     PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
  164.     PORT_DIPSETTING(      0x0000, DEF_STR( On )  )
  165.  
  166.     PORT_START    // IN3 - $10000a - DSW 2
  167.     PORT_DIPNAME( 0x0001, 0x0001, "Coin Slots" )
  168.     PORT_DIPSETTING(      0x0001, "1" )
  169.     PORT_DIPSETTING(      0x0000, "2" )
  170.     PORT_DIPNAME( 0x0002, 0x0002, "2 Player Game" )
  171.     PORT_DIPSETTING(      0x0002, "2 Credits" )
  172.     PORT_DIPSETTING(      0x0000, "1 Credit" )
  173.     PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Demo_Sounds ) )
  174.     PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
  175.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  176.     PORT_DIPNAME( 0x0008, 0x0008, "Allow Continue" )
  177.     PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
  178.     PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
  179.     PORT_DIPNAME( 0x0010, 0x0010, "Blood" )
  180.     PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
  181.     PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
  182.     PORT_DIPNAME( 0x0020, 0x0020, "Unknown 2-5" )
  183.     PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
  184.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  185.     PORT_DIPNAME( 0x0040, 0x0040, "Unknown 2-6" )
  186.     PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
  187.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  188.     PORT_DIPNAME( 0x0080, 0x0080, "Unknown 2-7" )
  189.     PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
  190.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  191. INPUT_PORTS_END
  192.  
  193.  
  194.  
  195.  
  196. /***************************************************************************
  197.  
  198.  
  199.                                 Graphics Layouts
  200.  
  201.  
  202. ***************************************************************************/
  203.  
  204. /* 8x8x4 tiles */
  205. static struct GfxLayout layout_8x8x4 =
  206. {
  207.     8,8,
  208.     RGN_FRAC(1,1),
  209.     4,
  210.     {0,1,2,3},
  211.     {0*4,1*4,2*4,3*4,4*4,5*4,6*4,7*4},
  212.     {0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32},
  213.     8*8*4
  214. };
  215.  
  216.  
  217. /* 16x16x4 tiles (made of four 8x8 tiles) */
  218. static struct GfxLayout layout_16x16x4 =
  219. {
  220.     16,16,
  221.     RGN_FRAC(1,1),
  222.     4,
  223.     {0,1,2,3},
  224.     {0*4,1*4,2*4,3*4,4*4,5*4,6*4,7*4,
  225.      128*4,129*4,130*4,131*4,132*4,133*4,134*4,135*4},
  226.     {0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32,
  227.      8*32,9*32,10*32,11*32,12*32,13*32,14*32,15*32},
  228.     16*16*4
  229. };
  230.  
  231.  
  232. /* 16x16x4 tiles (made of four 8x8 tiles). The bytes are swapped */
  233. static struct GfxLayout layout_16x16x4_swap =
  234. {
  235.     16,16,
  236.     RGN_FRAC(1,1),
  237.     4,
  238.     {0,1,2,3},
  239.     {2*4,3*4,0*4,1*4,6*4,7*4,4*4,5*4,
  240.      130*4,131*4,128*4,129*4,134*4,135*4,132*4,133*4},
  241.     {0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32,
  242.      8*32,9*32,10*32,11*32,12*32,13*32,14*32,15*32},
  243.     16*16*4
  244. };
  245.  
  246.  
  247. /***************************************************************************
  248.                                 Power Instinct
  249. ***************************************************************************/
  250.  
  251. static struct GfxDecodeInfo powerins_gfxdecodeinfo[] =
  252. {
  253.     { REGION_GFX1, 0, &layout_16x16x4,      0x000, 0x20 }, // [0] Tiles
  254.     { REGION_GFX2, 0, &layout_8x8x4,        0x200, 0x10 }, // [1] Tiles
  255.     { REGION_GFX3, 0, &layout_16x16x4_swap, 0x400, 0x40 }, // [2] Sprites
  256.     { -1 }
  257. };
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264. /***************************************************************************
  265.  
  266.  
  267.                                 Machine Drivers
  268.  
  269.  
  270. ***************************************************************************/
  271.  
  272.  
  273. /***************************************************************************
  274.                                 Power Instinct
  275. ***************************************************************************/
  276.  
  277. static struct OKIM6295interface powerins_okim6295_interface =
  278. {
  279.     1,
  280.     { 6000 },        /* ? */
  281.     { REGION_SOUND1 },
  282.     { 100 }
  283. };
  284.  
  285. static struct MachineDriver machine_driver_powerins =
  286. {
  287.     {
  288.         {
  289.             CPU_M68000,
  290.             10000000,    /* ? (it affects the game's speed!) */
  291.             powerins_readmem, powerins_writemem,0,0,
  292.             m68_level4_irq, 1
  293.         },
  294.     },
  295.     60, DEFAULT_60HZ_VBLANK_DURATION,
  296.     1,
  297.     0,
  298.  
  299.     /* video hardware */
  300.     320, 256, { 0, 320-1, 0+16, 256-16-1 },
  301.     powerins_gfxdecodeinfo,
  302.     0x800, 0x800,
  303.     0,
  304.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  305.     0,
  306.     powerins_vh_start,
  307.     0,
  308.     powerins_vh_screenrefresh,
  309.  
  310.     /* sound hardware */
  311.     0,0,0,0,
  312.     {
  313.         {
  314.             SOUND_OKIM6295,
  315.             &powerins_okim6295_interface
  316.         }
  317.     }
  318. };
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325. /***************************************************************************
  326.  
  327.  
  328.                                 ROMs Loading
  329.  
  330.  
  331. ***************************************************************************/
  332.  
  333.  
  334.  
  335. /***************************************************************************
  336.  
  337.                                 Power Instinct
  338.  
  339. Location     Device       File ID     Checksum
  340. ----------------------------------------------
  341.              27C240        ROM1         4EA1    [ MAIN PROGRAM ]
  342.              27C240        ROM2         FE60    [ PROGRAM DATA ]
  343.              27C010        ROM3         B9F7    [  CHARACTER   ]
  344.              27C040        ROM4         2780    [  BACKGROUND  ]
  345.              27C040        ROM5         98E0    [   PCM DATA   ]
  346.             23C1600        ROM6         D9E9    [  BACKGROUND  ]
  347.             23C1600        ROM7         8B04    [  MOTION OBJ  ]
  348.             23C1600        ROM8         54B2    [  MOTION OBJ  ]
  349.             23C1600        ROM9         C7C8    [  MOTION OBJ  ]
  350.             23C1600        ROM10        852A    [  MOTION OBJ  ]
  351.  
  352. Notes:  This archive is of a bootleg version
  353.         The main program is encrypted, using PLDs
  354.  
  355. Brief hardware overview
  356. -----------------------
  357.  
  358. Main processor  -  68000
  359.                 -  TPC1020AFN-084C (CPLD)
  360.  
  361. Sound processor -  Main processor
  362.                 -  K-665-9249      (M6295)
  363.  
  364. ***************************************************************************/
  365.  
  366. ROM_START( powerins )
  367.     ROM_REGION( 0x100000, REGION_CPU1 )        /* 68000 Code */
  368.     ROM_LOAD_WIDE_SWAP( "rom1", 0x000000, 0x080000, 0xb86c84d6 )
  369.     ROM_LOAD_WIDE_SWAP( "rom2", 0x080000, 0x080000, 0xd3d7a782 )
  370.  
  371.     ROM_REGION( 0x280000, REGION_GFX1 | REGIONFLAG_DISPOSE )    /* Layer 0 */
  372.     ROM_LOAD( "rom6",  0x000000, 0x200000, 0xb6c10f80 )
  373.     ROM_LOAD( "rom4",  0x200000, 0x080000, 0x2dd76149 )
  374.  
  375.     ROM_REGION( 0x100000, REGION_GFX2 | REGIONFLAG_DISPOSE )    /* Layer 1 */
  376.     ROM_LOAD( "rom3",  0x000000, 0x020000, 0x6a579ee0 )
  377.  
  378.     ROM_REGION( 0x800000, REGION_GFX3 | REGIONFLAG_DISPOSE )    /* Sprites */
  379.     ROM_LOAD( "rom10", 0x000000, 0x200000, 0xefad50e8 )
  380.     ROM_LOAD( "rom9",  0x200000, 0x200000, 0x08229592 )
  381.     ROM_LOAD( "rom8",  0x400000, 0x200000, 0xb02fdd6d )
  382.     ROM_LOAD( "rom7",  0x600000, 0x200000, 0x92ab9996 )
  383.  
  384.     ROM_REGION( 0x090000, REGION_SOUND1 )    /* 8 bit adpcm (banked) */
  385.     ROM_LOAD( "rom5", 0x000000, 0x030000, 0x88579c8f )
  386.     ROM_CONTINUE(     0x040000, 0x050000             )
  387. ROM_END
  388.  
  389.  
  390.  
  391.  
  392. /***************************************************************************
  393.  
  394.  
  395.                                 Game Drivers
  396.  
  397.  
  398. ***************************************************************************/
  399.  
  400. GAME( 1993, powerins, 0, powerins, powerins, 0, ROT0_16BIT, "Atlus", "Power Instinct (USA) [bootleg]" )
  401.